<?php

namespace app\admin\validate;

use think\Validate;

class Admin extends Validate
{    
    /**
     * 验证规则
     */
    protected $rule = [
        'username|登录名'  => 'require|alphaDash|unique:admin|length:3,20|chsDash',
        'nickname|昵称'  => 'require|max:50',
        'password' => 'require|max:32',
        'salt' => 'length:6',
        'avatar' => 'max:100',
        'email|邮箱'  => 'require|email|max:100',
    ];

    /**
     * 提示消息
     */
    protected $message = [
        // 'username.require'  =>  '登录名不能为空',
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['username','nickname', 'salt', 'password', 'email'],
        'edit' => ['nickname', 'email'],
    ];
    
}
